/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 19182
 * Date: 2025-08-09
 * Time: 21:34
 */
public class SortTest2 {
    public void shellSort(int[] array){
        int gap = array.length;
        while(gap > 1){
            gap = gap / 2;
            shell(array, gap);
        }
    }
    private void shell(int[] array, int gap){
        for(int i = gap; i < array.length; i++){
            int tmp = array[i];
            int end = i - gap;
            while(end >= 0){
                if(array[end] > tmp){
                    array[end + gap] = array[end];
                    end -= gap;
                }else{
                    break;
                }
            }
            array[end + gap] = tmp;
        }
    }

}
